package org.nViron.nvOrganic;

//~--- non-JDK imports --------------------------------------------------------

import java.util.Iterator;

import org.nViron.nvOrganism.nvOrganism;
import org.nViron.nvOrganism.nvOrganismMgr;
import org.nViron.nvOrganism.nvStateMgr;
import org.nViron.nvRender.nvRenderer;
import org.nViron.nvSim.nvSimulator;

/**
 * Manages tissues, removes dead ones but does not call update or render (this is done from within organics)
 * @author Roland Haring <p>
 * <script type="text/javascript" src="http://www.ohloh.net/p/376434/widgets/project_basic_stats.js"></script>
 */
public class nvTissueMgr extends nvOrganismMgr {
    public nvTissueMgr(nvSimulator simulator) {
        super(simulator);
    }

    @Override
    public void render(nvRenderer renderer) {

        // do nothing here
    }

    @Override
    public void update(float timeStep) {

        // do not call super class
        for (Iterator i = getOrganisms().values().iterator(); i.hasNext(); ) {
            nvOrganism organism = (nvOrganism)i.next();
            if (organism.getState() == nvStateMgr.DEAD) {
                i.remove();
            }
        }
    }
}



